#ifndef ENGINE_H_INCLUDED
#define ENGINE_H_INCLUDED

#include "StateMachine.h"
#include "Artist.h"
#include "Camera.h"
#include "Map.h"
#include "Unit.h"
#include "helpers.h"

class Engine
{
    public:
        Engine(Artist* artistPointer, StateMachine* statePointer);
        void newGame();
        void loadGame();
        void run();

    private:
        StateMachine* stateMachine;
        Artist* artist;

        Unit* player;

        SDL_Event event;
        Direction gravity_dir;
        int gravity;

        Camera camera;
        Map map;

        void check_events();
        void update();
        void display();
        void validateCamera();
        void playerJump();
        bool tryStep(Direction dir, int& i, bool reverse = false);
        bool canStep(Direction dir);
        bool onGround(Unit*);

};

#endif // ENGINE_H_INCLUDED
